-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade xterm.js to 3.1.0 #3189
Conversation
I'm not very familiar with bower, but we would need to get |
You may be able to get away with inventing a fake "xtermjs-css" package and using that. |
This suffers from the same problem that is holding up JupyterLab: we can't specify the padding yet. You could work around it here by adding an extra wrapper div so that the terminal host div is already inset from the wrapper. |
@blink1073 couldn't you just wrap the element you open xterm in inside a container with some padding? Does this not work? |
Yep, that's what I recommended above 😉. We didn't do that in JupyterLab because we were about to have a major release and there were a few other things that were not quite working yet in the changeover. |
@blink1073 oh ok, I thought that was a blocker for you |
Ok, so what to do about this PR? |
@cancan101, I'd say wrap this element as @Tyriar recommended above: |
I'm not sure that fix works. Maybe we have to wait for xtermjs/xterm.js#1123? |
@cancan101, why wouldn't wrapping the div work? It might also take updating some CSS/LESS. |
Ah, I see what you mean. It is more invasive than I'd hoped. Yeah, I think we should wait for the upstream fix. |
xtermjs/xterm.js#1208 has been merged, so I guess we're just waiting for xtermjs 3.1.0 to be released. |
I bumped the version pin. Now I just need to set the padding. |
Just pulling in 3.1.0 but without making any CSS changes, I get: The left / top look okay, but something is overflowing on the right. EDIT Is this and this really the best way to calculate the number of columns / rows: (CC @Tyriar )? e.g. this is the hack fix I am using: diff --git a/notebook/static/terminal/js/main.js b/notebook/static/terminal/js/main.js
index 92b160753..4dbc3f55f 100644
--- a/notebook/static/terminal/js/main.js
+++ b/notebook/static/terminal/js/main.js
@@ -50,8 +50,8 @@ requirejs([
function calculate_size() {
var height = $(window).height() - header.offsetHeight;
var width = $('#terminado-container').width();
- var rows = Math.min(1000, Math.max(20, Math.floor(height/termRowHeight())-1));
- var cols = Math.min(1000, Math.max(40, Math.floor(width/termColWidth())-1));
+ var rows = Math.min(1000, Math.max(20, Math.floor(height/termRowHeight())-1))-7;
+ var cols = Math.min(1000, Math.max(40, Math.floor(width/termColWidth())-1))-7;
console.log("resize to :", rows , 'rows by ', cols, 'columns');
return {rows: rows, cols: cols};
} EDIT2 EDIT3 |
Yes resizing is a little more involved now, please report if the fit addon doesn't meet your needs. |
notebook/static/terminal/js/main.js
Outdated
@@ -29,13 +29,6 @@ requirejs([ | |||
var common_config = new configmod.ConfigSection('common', common_options); | |||
common_config.load(); | |||
|
|||
var login_widget = new loginwidget.LoginWidget('span#login_widget', common_options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please leave this in place - it makes the 'logout' button in the top right work.
notebook/static/terminal/js/main.js
Outdated
var geom = calculate_size(); | ||
terminal.term.resize(geom.cols, geom.rows); | ||
terminal.socket.send(JSON.stringify(["set_size", geom.rows, geom.cols, | ||
$(window).height(), $(window).width()])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to send the new size to the server so that it can trigger a resize in the running process. Try running a full-screen program like vim
or aptitude
, and resize the terminal while it's running.
ws.onopen = function(event) { | ||
ws.send(JSON.stringify(["set_size", size.rows, size.cols, | ||
window.innerHeight, window.innerWidth])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll still need to send this as well, so it knows how big the initial window is.
@takluyver ok reverted those and added some comments. |
@Tyriar ran into this issue: xtermjs/xterm.js#1283 . worked around it for the time being. |
Looks like tests failed since "PhantomJS has crashed". |
Thanks! The tests passed after I restarted the relevant job, and I've tried it manually. |
Closes #2850